function xOut=mtimes(x1,x2)

nx1 = size(x1);
nx2 = size(x2);

nr = nx1(1);
nc = nx2(2);




x1v = getval(x1);
x2v = getval(x2);
xOut.v = x1v*x2v;

if ~isa(x2,'deriv1s')
  nd = size(x1.d,2);
  for i=1:nd
    xOut.d(:,i) = reshape(reshape(x1.d(:,i),nx1) * x2v,numel(xOut.v),1);
  end
elseif ~isa(x1,'deriv1s')
  nd = size(x2.d,2);
  for i=1:nd
    xOut.d(:,i) = reshape(x1v * reshape(x2.d(:,i),nx2),numel(xOut.v),1);
  end
else
  nd = size(x1.d,2);
  for i=1:nd
    xOut.d(:,i) = reshape(reshape(x1.d(:,i),nx1) * x2v...
                          + x1v * reshape(x2.d(:,i),nx2),numel(xOut.v),1);
  end
end

xOut = class(xOut,'deriv1s');

